function addToCart() {
	var title = document.getElementById('caption').outerText;
	var gp = document.getElementById('goldprice').outerText;
	var lp = document.getElementById('loveprice').outerText;
	base_url = document.URL;
	id_start = base_url.indexOf('?id=') + 4;
	tempStr = unescape(base_url.substring(id_start));
	addCookie(tempStr, title, gp, lp);
}
function addCookie(id, title,gPrice,lPrice) {//添加cookie
	var ori = getCookie('swustAddPro');
	ori = ori.substring(1,ori.length  - 1);
//	alert('ori:\n' + ori);
	ori = "{" + ori + "[" + id + "||" + title + "||" + gPrice + "||" + lPrice + "]}";
	var str = "swustAddPro=" + escape(ori);
	document.cookie = str;
	alert("添加cookie成功:\n" + str)
}
function getCookie(c_name){
	//alert(document.cookie);
if (document.cookie.length>0)
 {
  c_start=document.cookie.indexOf(c_name + "=")
  if (c_start!=-1)
   { 
    c_start=c_start + c_name.length+1 
    c_end=document.cookie.indexOf(";",c_start)
    if (c_end==-1) c_end=document.cookie.length
    return unescape(document.cookie.substring(c_start,c_end))
   } 
  }
return ""
}
function delCookie(name) {
	var date = new Date();
	date.setTime(date.getTime() - 10000);
	document.cookie = name + "=; expires=" + date.toGMTString();
	//alert("删除成功");
}